﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" x:Class="MonitorTerminal.MainWindow"
        Title="监测终端" Height="350" Width="525">
    <Window.Resources>
        <HierarchicalDataTemplate x:Key="EditModeTemplate">
            <TextBox KeyDown="TextBox_KeyDown" Loaded="TextBox_Loaded" LostFocus="TextBox_LostFocus"
                     Text="{Binding NickName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                      BorderThickness="1" />
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate x:Key="DisplayModeTemplate" ItemsSource="{Binding Children}">
            <TextBlock Text="{Binding Text}" />
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate x:Key="ServiceItemTemplate" ItemsSource="{Binding Children}" ItemTemplate="{StaticResource DisplayModeTemplate}">
            <StackPanel Orientation="Horizontal" TreeViewItem.PreviewMouseLeftButtonDown="TreeViewItem_PreviewMouseLeftButtonDown">
                <TextBlock Text="{Binding NickName}" />
                <TextBlock Text="{Binding ServiceConnState, Mode= OneWay, StringFormat=({0})}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <Style TargetType="{x:Type TreeViewItem}">
            <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
            <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Menu Height="22" VerticalAlignment="Top">
        </Menu>
        <ToolBar Grid.Row="1">
        </ToolBar>
        <Grid x:Name="MainContent" Grid.Row="2" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid Width="150">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="98*" />
                    <ColumnDefinition Width="52*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TreeView x:Name="tvObjectResourceManager" Grid.ColumnSpan="2" Grid.Row="1" ItemTemplate="{StaticResource ServiceItemTemplate}">

                </TreeView>
                <ToolBar Grid.ColumnSpan="2">
                    <Button x:Name="btnConnected" Content="连接"/>
                    <Button x:Name="btnReConnected" Content="重新连接"/>
                    <Button x:Name="btnDisconnect" Content="断开"/>
                    <Button x:Name="btnDelete" Content="删除"/>
                </ToolBar>
            </Grid>
            <Grid x:Name="UcContainer" Grid.Column="1"/>
        </Grid>
        <StatusBar Grid.Row="3">
            <ListBoxItem Content="状态" HorizontalAlignment="Left"/>
            <ListBoxItem/>
        </StatusBar>
    </Grid>
</Window>
